#ifndef PINQTASKVIEW_H
#define PINQTASKVIEW_H

#include <QikMultiPageViewBase.h>
#include <QikAppUi.h>
#include "PinQDocument.h"
#include "PinQModel.h"
#include "PinQAppUi.h"

class CPinQTaskView : public CQikMultiPageViewBase
	{
public:
	static CPinQTaskView* NewLC(CQikAppUi& aAppUi, const TVwsViewId aParentViewId);
	~CPinQTaskView();

	TVwsViewId ViewId()const;
	void HandleCommandL(CQikCommand& aCommand);
	void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
	void TabActivatedL(TInt aTabId);
	
	void UpdateChoiceListL();
	TInt ChoiceIndexByHandle(TInt aHandle);
	
	TBool IsChoiceListDirty() const;
	void SetChoiceListDirty(TBool aDirty);
	
protected:	
	void ViewActivatedL(const TVwsViewId& aPrevViewId, const TUid aCustomMessageId,const TDesC8& aCustomMessage);
	CQikCommand* DynInitOrDeleteCommandL(CQikCommand* aCommand, const CCoeControl& aControlAddingCommands);
	void ViewConstructL();
	void SaveL();
	
private:

	void UpdateViewFromPinQModelL();
	void UpdatePinQModelFromViewL();
	
	void SaveItemCommandL();
	void DeleteItemCommandL();
	
	void SetZoomFactorL(TInt aZoomLevel);
	
	CPinQTaskView(CQikAppUi& aAppUi, const TVwsViewId aParentViewId);
	void ConstructL();
	inline CPinQModel& PinQModel(){return static_cast<CPinQAppUi&>(iQikAppUi).PinQModel();}
	inline CPinQDocument& PinQDocument(){return static_cast<CPinQAppUi&>(iQikAppUi).PinQDocument();}
	
private:
	CQikCommandManager& iCommandManager;
	/** Holds the default text for the rich text editors caption. */
	HBufC* iDefaultName;
	/** Holds the text for the Unfiled category. */
	HBufC* iCategoryUnfiled;
	/** The item that is being edited. */
	TUid iTaskUid;
	/** For matching choicelist indexes to category handles. */
	RArray<TInt> iCategoryChoiceListMatch;
	/** Indicates whether the choicelist should be updated or not. */
	TBool iChoiceListDirty;
	TBool iDataDirty;
	};

// vim: ts=2:sw=2
#endif
